package com.heima.feigns;

import com.heima.config.FeignConfig;
import com.heima.feigns.fallback.WemediaFallBack;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wmUser.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(
        value = "leadnews-wemedia",
        configuration = FeignConfig.class,
        fallbackFactory = WemediaFallBack.class
)
public interface WemediaFeign {

    @GetMapping("api/v1/user/findByName/{name}")
    ResponseResult<WmUser> findWmUserByName(@PathVariable("name") String name);

    @PostMapping("api/v1/user/save")
    ResponseResult<WmUser> addWmUser(@RequestBody WmUser wmUser);

    @GetMapping("/api/v1/news/one/{id}")
    ResponseResult<WmNews> findNewById(@PathVariable("id") Integer id);

    @PutMapping("/api/v1/news/update")
    ResponseResult updateWmNews(@RequestBody WmNews wmNews);

    @GetMapping("/api/v1/user/findOne/{id}")
    ResponseResult<WmUser> findWmUserById(@PathVariable("id") Integer id);

    @GetMapping("/api/v1/news/findRelease")
    ResponseResult findRelease();

}
